﻿@model Wicresoft.UnifyShow.Business.SiteBranchModel
@{
    ViewBag.Title = "工单搜索";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section ScriptAndCss{
    <script type="text/javascript">
        window.onload = function () {
            if ('@Model.ID' != '101') {
                if ('@Model.Name' == '省局机关运维') {
                    $('#customer-company').combobox("setValue", "福建省烟草专卖局");
                    $('#customer-company').combobox("disable", true);
                    $('#submitter-company').combobox("setValue", "福建省烟草专卖局");
                    $('#submitter-company').combobox("disable", true);
                    $('#assignee-company').combobox("setValue", "福建省烟草专卖局");
                    $('#assignee-company').combobox("disable", true);
                }
                else if ('@Model.Name' == '中软海晟技术支持组') {
                    $('#assignee-company').combobox("setValue", "福建省烟草专卖局");
                    $('#assignee-company').combobox("disable", true);
                    $('#assignee-group').combobox("setValue", "中软海晟技术支持组");
                    $('#assignee-group').combobox("disable", true);
                    var data = [];
                    data.push({ label: '事件', value: '事件' });
                    data.push({ label: "变更", value: "变更" });
                    data.push({ label: '问题', value: '问题' });
                    data.push({ label: '任务', value: '任务' });
                    data.push({ label: '(清除)', value: '' });
                    $('#request-type').combobox("loadData", data);
                }
                else {
                    $('#customer-company').combobox("setValue", "@Model.Name");
                    $('#customer-company').combobox("disable", true);
                    $('#submitter-company').combobox("setValue", "@Model.Name");
                    $('#submitter-company').combobox("disable", true);
                    $('#assignee-company').combobox("clear");
                    var data = [];
                    data.push({ label: '福建省烟草专卖局', value: '福建省烟草专卖局' });
                    data.push({ label: "@Model.Name", value: "@Model.Name" });
                    data.push({ label: '全部', value: '@Model.Name;福建省烟草专卖局' });

                    $('#assignee-company').combobox("loadData", data);
                    $('#assignee-company').combobox("setValue", "@Model.Name");
                }
            }
            $('#btn_search').click();
        }
        function formateDesc(value, row, index) {
            var abValue = value;
            if (value.length >= 22) {
                abValue = value.substring(0, 19) + "...";
            }
            var content = '<a href="#" title="' + value + '" class="note">' + abValue + '</a>';
            return content;
        }
        $(function () {
            var boxWidth = $('.border_line > span').width() * 0.6;
            $('#general-status').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#general-status').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#general-status').combobox('clear');
                    }
                },
                data: [{
                    label: '办结',
                    value: '办结'
                }, {
                    label: '未办结',
                    value: '未办结'
                }, {
                    label: '(清除)',
                    value: ''
                }]
            });

            $('#request-status').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#request-status').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#request-status').combobox('clear');
                    }
                },
                data: []
            });

            $('#request-type').combobox({

                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#request-type').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#request-type').combobox('clear');
                    }
                },
                onChange: function (newValue, oldValue) {
                    var submittercompany = $('#submitter-company').combobox('getValue');
                    var g = $('#submitter-group').combobox('getValue');
                    $('#submitter-group').combobox('clear').combobox('reload', '/Search/GetGroups?company=' + encodeURI(submittercompany) + '&type=' + encodeURI(newValue));
                    $('#submitter').combobox('clear').combobox('reload', '/Search/GetPeople?company=' + encodeURI(submittercompany) + '&group=' + encodeURI(g) + '&type=' + encodeURI(newValue));

                    if (newValue == "事件") {
                        $("#incident_id_area").show();
                        $("#customer_company_area").show();
                        $("#customer_company_area").show();
                        $("#priority_area").show();
                        $("#submitter_group_area").show();
                        $("#assignee_company_area").show();
                        $("#assignee_group_area").show();
                        $("#assignee_group_area").show();
                        $("#assignee_area").show();
                        var incidentid = $('#incident-id').val('');

                        if ('@Model.Name' != '省局机关运维' && '@Model.Name' != '中软海晟技术支持组') {
                            var submittergroup = $('#submitter-group').combobox('clear');
                            var assigneegroup = $('#assignee-group').combobox('clear');
                        }
                        if ('@Model.ID' == '101') {
                            if ('@Model.Name' != '省局机关运维' && '@Model.Name' != '中软海晟技术支持组') {
                                var customercompany = $('#customer-company').combobox('clear');
                            }
                        }

                    }
                    else if (newValue != "自服务" && newValue != "事件") {
                        $("#incident_id_area").hide();
                        $("#customer_company_area").hide();
                        $("#priority_area").show();
                        $("#submitter_group_area").show();
                        $("#assignee_company_area").show();
                        $("#assignee_group_area").show();
                        $("#assignee_group_area").show();
                        $("#assignee_area").show();
                        var incidentid = $('#incident-id').val('');
                    }
                    else if (newValue == "自服务") {
                        $("#incident_id_area").hide();
                        $("#customer_company_area").hide();
                        $("#priority_area").hide();
                        $("#submitter_group_area").hide();
                        $("#assignee_company_area").hide();
                        $("#assignee_group_area").hide();
                        $("#assignee_group_area").hide();
                        $("#assignee_area").hide();


                        var incidentid = $('#incident-id').val('');
                        if ('@Model.Name' != '省局机关运维' && '@Model.Name' != '中软海晟技术支持组') {
                            var submittergroup = $('#submitter-group').combobox('clear');
                            var assigneegroup = $('#assignee-group').combobox('clear');
                        }
                        if ('@Model.ID' == '101') {
                            if ('@Model.Name' != '省局机关运维' && '@Model.Name' != '中软海晟技术支持组') {
                                var customercompany = $('#customer-company').combobox('clear');
                            }
                        }
                    }
                    else {
                        $("#onlyincidentbox").hide();
                        $("#onselfbox").show();
                        var incidentid = $('#incident-id').val('');

                        if ('@Model.Name' != '省局机关运维' && '@Model.Name' != '中软海晟技术支持组') {
                            var submittergroup = $('#submitter-group').combobox('clear');
                            var assigneegroup = $('#assignee-group').combobox('clear');
                        }
                        if ('@Model.ID' == '101') {
                            if ('@Model.Name' != '省局机关运维' && '@Model.Name' != '中软海晟技术支持组') {
                                var customercompany = $('#customer-company').combobox('clear');
                            }
                        }
                    }

                    if ('@Model.Name' != '中软海晟技术支持组') {
                        var assigneeg = $('#submitter-group').combobox('getValue');
                        var assigneecompany = $('#assignee-company').combobox('getValue');
                        $('#assignee-group').combobox('clear').combobox('reload', '/Search/GetGroups?company=' + encodeURI(assigneecompany) + '&type=' + encodeURI(newValue));
                        $('#assignee').combobox('clear').combobox('reload', '/Search/GetPeople?company=' + encodeURI(assigneecompany) + '&group=' + encodeURI(assigneeg) + '&type=' + encodeURI(newValue));
                       }

                    $('#request-status').combobox('clear');
                    if (newValue == '事件') {
                        $('#request-status').combobox('loadData',
                        [{ label: '新建', value: '0' }
                        , { label: '已派发', value: '1' }
                        , { label: '处理中', value: '2' }
                        , { label: '已解决', value: '4' }
                        , { label: '关闭', value: '5' }
                        , { label: '暂停', value: '3' }, {
                            label: '(清除)',
                            value: ''
                        }]);
                    } else if (newValue == '变更') {
                        $('#request-status').combobox('loadData',
                        [{ label: '已提交', value: '0' }
                        , { label: '已设计', value: '1' }
                        , { label: '变更请求', value: '3' }
                        , { label: '正在执行', value: '7' }
                        , { label: '已暂停', value: '8' }
                        , { label: '已完成', value: '10' }
                        , { label: '已关闭', value: '11' }
                        , { label: '已退回', value: '已退回' }
                        , { label: '已拒绝', value: '9' }, {
                            label: '(清除)',
                            value: ''
                        }]);
                    } else if (newValue == '问题') {
                        $('#request-status').combobox('loadData',
                        [{ label: '草稿', value: '0' }
                        , { label: '评审中', value: '1' }
                        , { label: '调查中', value: '4' }
                        , { label: '待决', value: '5' }
                        , { label: '已完成', value: '6' }
                        , { label: '已关闭', value: '8' }
                        , { label: '已取消', value: '9' }, {
                            label: '(清除)',
                            value: ''
                        }]);
                    } else if (newValue == '任务') {
                        $('#request-status').combobox('loadData',
                        [{ label: '新建', value: '1000' }
                        , { label: '已指派', value: '2000' }
                        , { label: '处理中', value: '4000' }
                        , { label: '等待', value: '5000' }
                        , { label: '已关闭', value: '6000' }, {
                            label: '(清除)',
                            value: ''
                        }]);
                    } else if (newValue == '自服务') {
                        $('#request-status').combobox('loadData',
                        [{ label: '审批中', value: '1' }
                        , { label: '等待中', value: '2' }
                        , { label: '处理中', value: '3' }
                        , { label: '已完成', value: '4' }
                        , { label: '已拒绝', value: '5' }
                        , { label: '已取消', value: '6' }, {
                            label: '(清除)',
                            value: ''
                        }]);
                    } else if (newValue == '') {
                        $('#request-status').combobox('loadData',
                        []);
                    }

                },
                data: [{
                    label: '事件',
                    value: '事件'
                }, {
                    label: '变更',
                    value: '变更'
                }, {
                    label: '问题',
                    value: '问题'
                }, {
                    label: '任务',
                    value: '任务'
                }, {
                    label: '自服务',
                    value: '自服务'
                }, {
                    label: '(清除)',
                    value: ''
                }]
            });

            $('#request-priority').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#request-priority').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#request-priority').combobox('clear');
                    }
                },
                data: [
                { label: '高', value: '1' }
                , { label: '中', value: '2' }
                , { label: '低', value: '3' }, {
                    label: '(清除)',
                    value: ''
                }]
            });

            $('#request-begintime').datebox({
                width: boxWidth,
                currentText: '今天',
                closeText: '关闭'
            });
            $('#request-endtime').datebox({
                width: boxWidth,
                currentText: '今天',
                closeText: '关闭'
            });

            $('#customer-company').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#customer-company').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#customer-company').combobox('clear');
                    }
                },
                data: [
                { label: '福建省烟草专卖局', value: '福建省烟草专卖局' }
                , { label: '三明市烟草专卖局', value: '三明市烟草专卖局' }
                , { label: '龙岩市烟草专卖局', value: '龙岩市烟草专卖局' }
                , { label: '南平市烟草专卖局', value: '南平市烟草专卖局' }
                , { label: '莆田市烟草专卖局', value: '莆田市烟草专卖局' }
                , { label: '厦门市烟草专卖局', value: '厦门市烟草专卖局' }
                , { label: '宁德市烟草专卖局', value: '宁德市烟草专卖局' }
                , { label: '泉州市烟草专卖局', value: '泉州市烟草专卖局' }
                , { label: '漳州市烟草专卖局', value: '漳州市烟草专卖局' }
                , { label: '福州市烟草专卖局', value: '福州市烟草专卖局' }
                , { label: '三明金叶复烤有限公司', value: '三明金叶复烤有限公司' }
                , { label: '中国烟草福建进出口该公司', value: '中国烟草福建进出口该公司' }
                , { label: '福建武夷烟叶有限公司', value: '福建武夷烟叶有限公司' }
                , { label: '福建烟草海晟投资管理有限公司', value: '福建烟草海晟投资管理有限公司' }, {
                    label: '(清除)',
                    value: ''
                }]
            });

            $('#submitter-company').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#submitter-company').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#submitter-company').combobox('clear');
                    }
                },
                onChange: function (newValue) {
                    var requesttype = $('#request-type').combobox('getValue');
                    $('#submitter-group').combobox('clear').combobox('reload', '/Search/GetGroups?company=' + encodeURI(newValue) + '&type=' + encodeURI(requesttype));
                    //$('#submitter').combobox('clear').combobox('reload', '/Search/GetPeople');
                    
                    $('#submitter').combobox('clear').combobox('reload', '/Search/GetPeople?company=' + encodeURI(newValue) + '&type=' + encodeURI(requesttype));

                },
                data: [
                { label: '福建省烟草专卖局', value: '福建省烟草专卖局' }
                , { label: '三明市烟草专卖局', value: '三明市烟草专卖局' }
                , { label: '龙岩市烟草专卖局', value: '龙岩市烟草专卖局' }
                , { label: '南平市烟草专卖局', value: '南平市烟草专卖局' }
                , { label: '莆田市烟草专卖局', value: '莆田市烟草专卖局' }
                , { label: '厦门市烟草专卖局', value: '厦门市烟草专卖局' }
                , { label: '宁德市烟草专卖局', value: '宁德市烟草专卖局' }
                , { label: '泉州市烟草专卖局', value: '泉州市烟草专卖局' }
                , { label: '漳州市烟草专卖局', value: '漳州市烟草专卖局' }
                , { label: '福州市烟草专卖局', value: '福州市烟草专卖局' }
                , { label: '三明金叶复烤有限公司', value: '三明金叶复烤有限公司' }
                , { label: '中国烟草福建进出口该公司', value: '中国烟草福建进出口该公司' }
                , { label: '福建武夷烟叶有限公司', value: '福建武夷烟叶有限公司' }
                , { label: '福建烟草海晟投资管理有限公司', value: '福建烟草海晟投资管理有限公司' }, {
                    label: '(清除)',
                    value: ''
                }]
            });

            $('#assignee-company').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#assignee-company').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#assignee-company').combobox('clear');
                    }
                },
                onChange: function (newValue) {
                    var requesttype = $('#request-type').combobox('getValue');
                    $('#assignee-group').combobox('clear').combobox('reload', '/Search/GetGroups?company=' + encodeURI(newValue) + '&type=' + encodeURI(requesttype));
                    //$('#assignee').combobox('clear').combobox('reload', '/Search/GetPeople');
                    var g = $('#assignee-group').combobox('getValue');
                    $('#assignee').combobox('clear').combobox('reload', '/Search/GetPeople?company=' + encodeURI(newValue) + '&group=' + encodeURI(g) + '&type=' + encodeURI(requesttype));

                },
                data: [
                { label: '福建省烟草专卖局', value: '福建省烟草专卖局' }
                , { label: '三明市烟草专卖局', value: '三明市烟草专卖局' }
                , { label: '龙岩市烟草专卖局', value: '龙岩市烟草专卖局' }
                , { label: '南平市烟草专卖局', value: '南平市烟草专卖局' }
                , { label: '莆田市烟草专卖局', value: '莆田市烟草专卖局' }
                , { label: '厦门市烟草专卖局', value: '厦门市烟草专卖局' }
                , { label: '宁德市烟草专卖局', value: '宁德市烟草专卖局' }
                , { label: '泉州市烟草专卖局', value: '泉州市烟草专卖局' }
                , { label: '漳州市烟草专卖局', value: '漳州市烟草专卖局' }
                , { label: '福州市烟草专卖局', value: '福州市烟草专卖局' }
                , { label: '三明金叶复烤有限公司', value: '三明金叶复烤有限公司' }
                , { label: '中国烟草福建进出口该公司', value: '中国烟草福建进出口该公司' }
                , { label: '福建武夷烟叶有限公司', value: '福建武夷烟叶有限公司' }
                , { label: '福建烟草海晟投资管理有限公司', value: '福建烟草海晟投资管理有限公司' }, {
                    label: '(清除)',
                    value: ''
                }]
            });


            $('#submitter-group').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#submitter-group').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#submitter-group').combobox('clear');
                        var requesttype = $('#request-type').combobox('getValue');
                        var submittercompany = $('#submitter-company').combobox('getValue');
                        var g = $('#submitter-group').combobox('getValue');
                        $('#submitter').combobox('clear').combobox('reload', '/Search/GetPeople?company=' + encodeURI(submittercompany) + '&group=' + encodeURI(g) + '&type=' + encodeURI(requesttype));
                    }
                },
                onChange: function (newValue) {
                    var c = $('#submitter-company').combobox('getValue');
                    var requesttype = $('#request-type').combobox('getValue');
                    $('#submitter').combobox('clear').combobox('reload', '/Search/GetPeople?group=' + encodeURI(newValue) + '&company=' + encodeURI(c) + '&type=' + encodeURI(requesttype));
                },
                data: []
            });

            $('#submitter').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#submitter').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#submitter').combobox('clear');
                    }
                },
                data: []
            });

            $('#assignee-group').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#assignee-group').combobox('clear');
                    if (data.length > 0) {
                        if ('@Model.Name' == '中软海晟技术支持组') {
                            $('#assignee-group').combobox("setValue", "中软海晟技术支持组");
                            $('#assignee-group').combobox("disable", true);
                        }
                    }
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#assignee-group').combobox('clear');
                        var requesttype = $('#request-type').combobox('getValue');
                        var submittercompany = $('#assignee-company').combobox('getValue');
                        var g = $('#assignee-group').combobox('getValue');
                        $('#assignee').combobox('clear').combobox('reload', '/Search/GetPeople?company=' + encodeURI(submittercompany)+'&group=' + encodeURI(g) + '&type=' + encodeURI(requesttype));
                    }
                },
                onChange: function (newValue) {
                    var c = $('#assignee-company').combobox('getValue');
                    var requesttype = $('#request-type').combobox('getValue');
                    $('#assignee').combobox('clear').combobox('reload', '/Search/GetPeople?group=' + encodeURI(newValue) + '&company=' + encodeURI(c) + '&type=' + encodeURI(requesttype));
                },
                data: []
            });

            $('#assignee').combobox({
                panelHeight: 'auto',
                width: boxWidth,
                editable: false,
                valueField: 'value',
                textField: 'label',
                onLoadSuccess: function (data) {
                    $('#assignee').combobox('clear');
                },
                onSelect: function (record) {
                    if (record.value == '') {
                        $('#assignee').combobox('clear');
                    }
                },
                data: []
            });

            $('#btn_search').linkbutton({
                plain: false
            });
            $('#btn_export').linkbutton({
                plain: false
            });
            $('#btn_clear').linkbutton({
                plain: false
            });

            $('#btn_search').click(function () {
                var incidentid = $('#incident-id').val();
                var generalstatus = $('#general-status').combobox('getValue');
                var requesttype = $('#request-type').combobox('getValue');
                var requeststatus = $('#request-status').combobox('getValue');
                var requestpriority = $('#request-priority').combobox('getValue');
                var requestbegintime = $('#request-begintime').datetimebox('getValue');
                var requestendtime = $('#request-endtime').datetimebox('getValue');
                var customercompany = $('#customer-company').combobox('getValue');
                var submittercompany = $('#submitter-company').combobox('getValue');
                var submittergroup = $('#submitter-group').combobox('getValue');
                var submitter = $('#submitter').combobox('getValue');
                var assigneecompany = $('#assignee-company').combobox('getValue');
                var assigneegroup = $('#assignee-group').combobox('getValue');
                var assignee = $('#assignee').combobox('getValue');
                var subject = $('#subject').val();

                $('#dg').datagrid('options').url = "/Search/SearchResult?incidentid=" + incidentid + "&generalstatus=" + encodeURI(generalstatus) + "&requesttype=" + encodeURI(requesttype) + "&requeststatus=" + encodeURI(requeststatus) + "&requestpriority=" + encodeURI(requestpriority) + "&requestbegintime=" + requestbegintime + "&requestendtime=" + requestendtime + "&customercompany=" + encodeURI(customercompany) + "&submittercompany=" + encodeURI(submittercompany) + "&submittergroup=" + encodeURI(submittergroup) + "&submitter=" + encodeURI(submitter) + "&assigneecompany=" + encodeURI(assigneecompany) + "&assigneegroup=" + encodeURI(assigneegroup) + "&assignee=" + encodeURI(assignee) + "&subject=" + encodeURI(subject);

                $('#dg').datagrid('load');
            });

            $('#btn_export').click(function () {
                var incidentid = $('#incident-id').val();
                var generalstatus = $('#general-status').combobox('getValue');
                var requesttype = $('#request-type').combobox('getValue');
                var requeststatus = $('#request-status').combobox('getValue');
                var requestpriority = $('#request-priority').combobox('getValue');
                var requestbegintime = $('#request-begintime').datetimebox('getValue');
                var requestendtime = $('#request-endtime').datetimebox('getValue');
                var customercompany = $('#customer-company').combobox('getValue');
                var submittercompany = $('#submitter-company').combobox('getValue');
                var submittergroup = $('#submitter-group').combobox('getValue');
                var submitter = $('#submitter').combobox('getValue');
                var assigneecompany = $('#assignee-company').combobox('getValue');
                var assigneegroup = $('#assignee-group').combobox('getValue');
                var assignee = $('#assignee').combobox('getValue');
                var subject = $('#subject').val();

                var url = "/Search/ExportToExcel?incidentid=" + incidentid + "&generalstatus=" + encodeURI(generalstatus) + "&requesttype=" + encodeURI(requesttype) + "&requeststatus=" + encodeURI(requeststatus) + "&requestpriority=" + encodeURI(requestpriority) + "&requestbegintime=" + requestbegintime + "&requestendtime=" + requestendtime + "&customercompany=" + encodeURI(customercompany) + "&submittercompany=" + encodeURI(submittercompany) + "&submittergroup=" + encodeURI(submittergroup) + "&submitter=" + encodeURI(submitter) + "&assigneecompany=" + encodeURI(assigneecompany) + "&assigneegroup=" + encodeURI(assigneegroup) + "&assignee=" + encodeURI(assignee) + "&subject=" + encodeURI(subject);
                window.open(url);
            });

            $('#btn_clear').click(function () {
                var incidentid = $('#incident-id').val('');
                var generalstatus = $('#general-status').combobox('clear');
                var requesttype = $('#request-type').combobox('clear');
                var requeststatus = $('#request-status').combobox('clear');
                var requestpriority = $('#request-priority').combobox('clear');
                var requestbegintime = $('#request-begintime').datetimebox('clear');
                var requestendtime = $('#request-endtime').datetimebox('clear');
                var submittergroup = $('#submitter-group').combobox('clear');
                var submitter = $('#submitter').combobox('clear');
                if ('@Model.Name' != '中软海晟技术支持组') {
                    var assigneegroup = $('#assignee-group').combobox('clear');
                }
                var assignee = $('#assignee').combobox('clear');
                var subject = $('#subject').val('');
                if ('@Model.ID' == '101') {
                    var customercompany = $('#customer-company').combobox('clear');
                    var submittercompany = $('#submitter-company').combobox('clear');
                    var assigneecompany = $('#assignee-company').combobox('clear');
                }
                $('#dg').datagrid('loadData', { total: 0, rows: [] });
            });
            $('#dg').datagrid({
                onLoadSuccess: function (data) {
                    $(".note").tooltip({
                        onShow: function () {
                            $(this).tooltip('tip').css({
                                width: '300',
                                boxShadow: '1px 1px 3px #292929'
                            });
                        }
                    });
                },
                onDblClickRow: function (rowIndex, rowData) {
                    var rnd = (new Date()).getMilliseconds() + "" + parseInt(Math.random() * 10000);
                    $.ajax({
                        url: 'Navigate/GetURL',
                        data: { type: rowData.TypeS, requestid: rowData.RequestID, nocatch: rnd },
                        success: function (result) {
                            window.open("/Account/SSO?redirectionUrl=" + encodeURI(result) + "catchid=" + rnd);
                        }

                    });
                }
            });
            var p = $('#dg').datagrid('getPager');

            $(p).pagination({
                beforePageText: '第',

                afterPageText: '页    共 {pages} 页',

                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'

            });
            $('#dg').datagrid("hideColumn", 'RequestID');
        });
    
    </script>
    <style type="text/css">
        #searcharea label
        {
            display: inline-block;
            width: 30%;
            border-bottom: #ffffff 1px solid;
            text-align: left;
            padding: 3px 3px 3px 5px;
            color: #404040;
            background-color: #eaf2ff;
            height: 23px;
            line-height:23px;
        }

        #searcharea input,#searcharea textarea { 
            width:60%;
            vertical-align:top;
        }

        .area_label
        {
            display: inline-block;
            width: 80px;
            border-bottom: #ffffff 1px solid;
            text-align: left;
            padding: 3px 3px 3px 5px;
            color: #404040;
            background-color: #eaf2ff;
            height: 50px;
        }

        .border_line > span { 
            width:30%;
            display:inline-block;
        }
    </style>
}
<div style="height:100%;">
    <div id="searcharea" style="height:40%;overflow-y:scroll;">
        <div class="padding55">
            <div class="border_line">
                <span>
                    <label>
                        请求类型</label>
                    <input type="text" id="request-type" />
                </span><span>
                    <label>
                        状态</label>
                    <input type="text" id="general-status" />
                </span><span>
                    <label>
                        开始时间</label>
                    <input type="text" id="request-begintime" />
                </span><span>
                    <label>
                        结束时间</label>
                    <input type="text" id="request-endtime" />
                </span><span>
                    <label>
                        工单状态</label>
                    <input type="text" id="request-status" />
                </span><span id="submitter_company_area">
                    <label>
                        建单人公司</label>
                    <input type="text" id="submitter-company" />
                </span><span id="submitter_group_area">
                    <label>
                        建单人组</label>
                    <input type="text" id="submitter-group" />
                </span><span id="submitter_area">
                    <label>
                        建单人</label>
                    <input type="text" id="submitter" />
                </span><span id="priority_area">
                    <label>
                        优先级</label>
                    <input type="text" id="request-priority" />
                </span><span id="assignee_company_area">
                    <label>
                        受派人公司</label>
                    <input type="text" id="assignee-company" />
                </span><span id="assignee_group_area">
                    <label>
                        受派人组</label>
                    <input type="text" id="assignee-group" />
                </span><span id="assignee_area">
                    <label>
                        受派人</label>
                    <input type="text" id="assignee" />
                </span><span id="incident_id_area" style="display: none;">
                    <label>
                        事件ID</label>
                    <input type="text" id="incident-id" />
                </span><span id="customer_company_area" style="display: none;">
                    <label>
                        客户公司</label>
                    <input type="text" id="customer-company" />
                </span>
                <br />
                <span>
                    <label class="area_label">
                                    摘要</label>
                    <textarea rows="2" cols="47" id="subject"></textarea>
                    @*<table border="0">
                        <tr>
                            <td>
                                <label class="area_label">
                                    摘要</label>
                            </td>
                            <td>
                                <textarea rows="2" cols="47" id="subject"></textarea>
                            </td>
                        </tr>
                    </table>*@
                </span>
            </div>
        </div>
        <div style="clear: both;">
        </div>
        <div class="padding55">
            <a id="btn_search" iconcls="icon-search">搜索</a> <a id="btn_clear" iconcls="icon-undo">
                清除</a><a id="btn_export" iconcls="icon-print"> 导出</a> @*<input type="button" value="搜索" /><input type="button" value="导出" />*@
        </div>
    </div>
    <div class="padding55" style="height:59%;">
        <table id="dg" fit="true" pagination="true" fitcolumns="true" singleselect="true">
            <thead>
                <tr>
                    <th field="RequestID" width="180">
                        请求ID
                    </th>
                    <th field="IDS" width="180" sortable="true">
                        请求ID
                    </th>
                    <th field="TypeS" width="80" sortable="true">
                        请求类型
                    </th>
                    <th field="Operation" width="50" sortable="true">
                        操作
                    </th>
                    <th field="Description" width="150" resizable="false" formatter="formateDesc" sortable="true">
                        摘要
                    </th>
                    <th field="Status" width="60" sortable="true">
                        状态
                    </th>
                    <th field="Priority" width="60" sortable="true">
                        优先级
                    </th>
                    <th field="AssignGroup" width="110" sortable="true">
                        受派者组
                    </th>
                    <th field="Assigner" width="80" sortable="true">
                        受派者
                    </th>
                    <th field="Submitter" width="80" sortable="true">
                        建单人
                    </th>
                    <th field="CreateDate" width="150" sortable="true">
                        建单日期
                    </th>
                </tr>
            </thead>
        </table>
    </div>
</div>
